<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/9/5
  Time: 16:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>UpdateUser</title>
    <style>
        div{
            text-align: center;
            margin-top: 30px;
        }
        input{
            margin: 10px ;
            font-size: 20px;
            text-align: center;
        }
    </style>
</head>
<body>
<h1 style="text-align: center;margin-top: 100px">修改用户信息</h1>
<form action="/updateAdmin" method="post">
    <div>
        <input type="hidden" id="id" name="id" value="${admin.id}" readonly>
        <label>账号：</label>
        <input type="text" value="${admin.name}" name="name" readonly>
        <br>
        <label>旧密码：</label>
        <input type="password" name="oldPassword">
        <br>
        <label>新密码：</label>
        <input type="password" name="password" id="password">
        <br>
        <label>再次输入新密码：</label>
        <input type="password" name="passwords" id="passwords">
        <br>
        <input style="width: 150px" type="submit" value="提交" onclick="checkPassword()">
        <br>
        <h3><a href="/toAdmin">返回</a></h3>

    </div>
</form>
</body>
<script>
    //判断密码是否为空
    function checkPassword() {
        let a = document.getElementById("password").value;
        let b = document.getElementById("passwords").value;
        if (a != b) {
            alert("两次密码不一致！");
            return false;
        } else {
            return true;
        }
    }
</script>
</html>
